package main

import "fmt"

// 父结构体
type Animal struct {
	name string
}

func (a *Animal) run() {
	fmt.Printf("%s is run\n", a.name)
}

// 结构体嵌套 继承
type Dog struct {
	Age int8
	*Animal
}

func (d *Dog) wang() {
	fmt.Printf("%s 会 汪汪叫\n", d.name)
}
func main() {
	littleDog := &Dog{
		Age: 4,
		Animal: &Animal{
			name: "哈士奇",
		},
	}
	littleDog.wang()
}
